﻿<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="BuyShortMessage.aspx.cs" Inherits="YY.Web.MyAgent.financial_information.BuyShortMessage" %>

<!DOCTYPE html>

<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
    <title></title>
    <link href="/jQuery/PlugIns/artdialog/ui-dialog.css" rel="stylesheet" type="text/css" />
    <link href="/skin/default/style.css" rel="stylesheet" type="text/css" />
    <script type="text/javascript" charset="utf-8" src="/jQuery/jquery-1.11.2.min.js"></script>
    <script type="text/javascript" src="/jQuery/jquery-1.8.3.min.js"></script>
    <script type="text/javascript" charset="utf-8" src="/jQuery/PlugIns/Validform/Validform_v5.3.2_min.js"></script>
    <script type="text/javascript" charset="utf-8" src="/js/common.js"></script>
    <script type="text/javascript">
        $(function () {
            $("#form1").initValidform();
            $.post("PriceHandler.ashx?action=price", function (data, status) {
                if (status == "success") {
                    var json = JSON.parse(data);
                    var outhtml = "";
                    outhtml += "<table border='0' cellspacing='0' width='50%' cellpadding='0' class='table'>";
                    outhtml += "<thead><tr><th>数量(条)</th><th>单价（元）</th></tr> </thead>";
                    $.each(json, function (key, value) {
                        outhtml += "<tr><td>" + value["counts"] + "</td>";
                        outhtml += "<td>" + value["price"] + "</td> </tr>";
                    });
                    outhtml += "</table>";
                    $("#pricetable").html(outhtml);
                }
            });
            /*短信充值算法*/
            $("#txtCZTS").focusout(
                function () {
                    var txtCount = $("#txtCZTS").val();
                    var sum = 0;
                    if (txtCount != "") {
                        txtCount = parseInt(txtCount);
                        if (txtCount > 0 && txtCount <= 500) {
                            sum = txtCount * 0.1;
                            $("#span_price").html("0.1");
                        } else {
                            sum = txtCount * 0.08;
                            $("#span_price").html("0.08");
                        }
                        $("#span_count").html(txtCount);
                        $("#txtCZJE").val(sum.toFixed(2));
                        $("#span_sum").html(sum.toFixed(2));
                    }
                }
                );
        });
        $("#form1").Validform({
            tiptype: 2,
            datatype: {//传入自定义datatype类型【方式二】;
                "empty": /^\s*$/,
                "mony": /^([1-9][\d]{0,7}|0)(\.[\d]{1,2})?$/,
            }
        });
        var isRight = false;
        function ValidationPayPwd() {
            var value = $("#txtPayPwd").val();

            $.post("FinanceHandler.ashx?action=CheckTradePassword", {"tradepassword": value }, function (data, status) {
                if (status == "success") {
                    if (data == "1") {
                        isRight = true;
                    } else {
                        alert("支付密码错误");
                        isRight = false;
                    }
                } else {
                    alert("支付异常");
                    isRight = false;
                }

            });
            return isRight;
        }
    </script>
    <style type="text/css">
        .table th {
            padding: 8px 0;
            color: #333;
            font-size: 12px;
            font-weight: 500;
            background: #fafafa;
            border-bottom: 1px solid #eee;
            line-height: 1.5em;
        }

        .table td {
            padding: 8px 0;
            text-indent: 5px;
            border: 1px solid #eee;
            line-height: 1.5em;
            color: #666;
        }
    </style>
</head>
<body class="mainbody">
    <form id="form1" runat="server">
        <!--导航栏-->
        <div class="location">
            <a href="#" onclick="javascript: history.back(-1);"  class="back"><i></i><span>返回上一页</span></a>
            <a href="/Center.aspx" class="home"><i></i><span>首页</span></a>
            <i class="arrow"></i>
            <a href="#"><span>短信充值</span></a>
            <i class="arrow"></i>
            <span>充值</span>
        </div>
        <div class="line10"></div>
        <!--/导航栏-->
        <!--内容-->
        <div id="floatHead" class="content-tab-wrap">
            <div class="content-tab">
                <div class="content-tab-ul-wrap">
                    <ul>
                        <li><a class="selected" href="javascript:;">短信充值</a></li>
                    </ul>
                </div>
            </div>
        </div>
        <div class="tab-content">
            <dl>
                <dt>充值账号</dt>
                <dd>
                    <asp:Label ID="lblUserName" runat="server" />
                    <a href="#" style="color: #2a72c5; cursor: pointer">查询充值记录</a>
                </dd>
            </dl>
            <dl>
                <dt>充值条数</dt>
                <dd>
                    <asp:TextBox ID="txtCZTS" runat="server" CssClass="input small" Width="80" datatype="mony" errormsg="您填写的金额格式不正确 示例：1.00" sucmsg=" "></asp:TextBox><span>条</span>
                    <span class="Validform_checktip">*单位：条</span>
                </dd>
            </dl>
            <dl>
                <dt>短信单价</dt>
                <dd>
                    <div id="pricetable">
                    </div>
                </dd>
            </dl>
            <dl>
                <dt>费用总计</dt>
                <dd>
                    <div>
                        <asp:TextBox ID="txtCZJE" runat="server" CssClass="input small" />
                        <span class="Validform_checktip">元</span><br />
                        <span class="Validform_checktip"><span id="span_count">0
                        </span>*<span id="span_price">0</span>=<span id="span_sum">0</span>元</span>
                    </div>
                </dd>
            </dl>
            <dl>
                <dt>支付密码</dt>
                <dd>
                    <div>
                        <asp:TextBox ID="txtPayPwd" TextMode="Password" runat="server" CssClass="input small"/>
                        <span class="Validform_checktip">请输入支付密码</span><br />

                    </div>
                </dd>
            </dl>
        </div>
        <!--工具栏-->
        <div class="page-footer">
            <div class="btn-wrap">
                <asp:Button ID="btnSubmit" runat="server" Text="去支付" CssClass="btn"  OnClientClick="return  ValidationPayPwd();" OnClick="btnSubmit_Click" />
                <input name="btnReturn" type="button" value="返回上一页" class="btn yellow" onclick="javascript: history.back(-1);" />
            </div>
        </div>
        <!--/工具栏-->
    </form>
</body>
</html>
